package com.cyf.cheyichong.mapper;

import com.cyf.cheyichong.entity.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Repository
public interface UserMapper {

    @Select(value = "select * from user where username = #{username}")
    User getUserByUsername(@Param("username") String username);

    @Select(value = "select * from user where user_phone = #{userPhone}")
    User getUserByUserPhone(@Param("userPhone") String userPhone);

    @Insert("insert into user(id, user_phone) values(#{id}, #{userPhone})")
    void addUser(User user);

    //    根据手机号查询用户id
    @Select("select id from user where user_phone = #{userPhone}")
    Long getUserId(User user);
}
